package svgedit.gui;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;

public class Line {
	int x1,y1,x2,y2;
	Color color,strokeColor;
	int strokeWidth;
	int width;
	int height;
	public Boolean isSelected=false;
	Shape shape;
	Graphics2D g2;
	
	public Line() {
		this.color=Color.white;
	}

	public Line(int x1,int y1,int x2,int y2,Color fillColor,Color strokeColor, int strokeWidth,
			Boolean isSelected) {
		
		this.x1=x1;
		this.x2=x2;
		this.y1=y1;
		this.y2=y2;
		this.color=fillColor;
		this.strokeColor=strokeColor;
		this.strokeWidth=strokeWidth;
		this.setIsSelected(isSelected);
	}

	public void draw(Graphics2D g) {
		Graphics2D g2 = (Graphics2D) g;
		if (isSelected==true) {
			g.setColor(color);
			g.setColor(Color.red);
			g.drawLine(x1, y1, x2, y2);
		}
		else {
		g.setColor(color.black);
		g.drawLine(x1, y1, x2, y2);
		g2.setColor(strokeColor);
		g2.setStroke(new BasicStroke(strokeWidth));
		g2.drawLine(x1, y1, x2, y2);
		}
	}
	
	public int getDX() {
		return x2-x1;
		
	}
	public int getDY() {
		return y2-y1;
	}
	public int getStrokeWidth()
	{
		return strokeWidth;
	}
	public Color getFillColor()
	{
		return color;
	}
	public Color getStrokeColor()
	{
		return strokeColor;
	}
	public void setIsSelected(Boolean select) {
		this.isSelected = select;
	}

	public Boolean getIsSelected() {
		return isSelected;
	}
	
	public int getX1()
	{
		return x1;
	}
	public int getY1()
	{
		return y1;
	}
	public int getX2()
	{
		return x2;
	}
	public int getY2()
	{
		return y2;
	}
	
}

